package com.bjb.config;

import com.bjb.filter.AcrossFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {
    /**
     * 配置跨域处理过滤器为第一执行，并配置拦截规则为.do ， .front和.show
     * @param acrossFilter
     * @return
     */
    @Bean
    public FilterRegistrationBean filterRegistrationBeanSSOSessionFilter(AcrossFilter acrossFilter){//AcrossFilter acrossFilter
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(acrossFilter);
        filterRegistrationBean.setEnabled(true);
        filterRegistrationBean.addUrlPatterns("*.do","*.show","*.front","*.app");//do后台管理系统  show门户网站  front微网页  app小程序
        filterRegistrationBean.setOrder(1);
        return filterRegistrationBean;
    }
}
